package com.wuyou.io;

import java.io.*;

public class Test_1 {


    public static void main(String[] args) throws IOException {
        String fileName = System.getProperty("user.dir") + "\\src\\main\\java\\" +(Test_1.class.getPackage().getName().replace(".", "\\") + "\\test.txt");
        File file = new File(fileName);
        OutputStream out = new FileOutputStream(file);
        String str = "The txt is used test 'IO'";
        out.write(str.getBytes());

        InputStream in = new FileInputStream(file);
        int len;
        while ((len = in.read()) != -1) {
            System.out.print((char)len);
        }
        System.out.println();



//        System.out.println(System.getProperty("user.dir") + (Test_1.class.getCanonicalName().replace(".", "\\")));
//        System.out.println(System.getProperty("user.dir") + Test_1.class.getPackage().getName().replace(".", "\\"));
//        System.out.println(System.getProperties());
//        System.out.println(System.getProperty("os.name"));

    }
}
